package servlet_item;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import factory.ItemManagerFactory;
import factory.UserManagerFactory;
import pojo.Item;
import pojo.User;
import service.ItemManager;
import service.UserManager;


public class findallServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
    private ItemManager im=ItemManagerFactory.getItemManagerInstance(); 

   
    public findallServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		List<Item> items=im.findAllItems();
		for(Item item:items){
			System.out.println(item.getDetails()+"..."+item.getItemId());
		}
		request.setCharacterEncoding("UTF-8");
		request.setAttribute("item", items);
		request.getRequestDispatcher("itemList.jsp").forward(request, response);
	}

	
}
